package logic

import (
	"context"
	"furni-net/furnirpc/furnirpc"

	"furni-net/api/internal/svc"
	"furni-net/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogic {
	return &ListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ListLogic) List(req *types.ListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	list, err := l.svcCtx.FurniRpc.ToolList(l.ctx, &furnirpc.ToolListRequest{})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    0,
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Message: "查询详情成功",
		Code:    200,
		Data:    list,
	}, nil
	
}
